home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC Gamer (Italian) 36
/
PC Gamer IT CD 36 2-2.iso
/
VIGDEMO
/
data1.cab
/
Assets
/
scripts
/
c4.e
< prev
next >
Wrap
Text File
|
1998-09-21
|
4KB
|
639 lines
int Initialize(string type)
{
global string gMessage;
global real gInRadius = 60.0;
global real gOutRadius = 90.0;
global int gNetwork = 0;
global int state = 0;
global real gTimer = 20.0;
global int hitValue = 80;
global real gExplodeRadius = 60.0;
global int gStartSound = 7;
global int gProgressSound = 18;
global int gEndSound = 27;
global real gMass = 5.0;
Reset("dummy");
return 0;
}
int Reset(string dummy)
{
state = 0;
wakeupTime = -1.0;
SetStyle(thisObject,2);
SetCollidableProperties(thisObject,1,0);
return 0;
}
int startsound(string soundname)
{
gStartSound = GetSoundIndex(soundname);
}
int endsound(string soundname)
{
gEndSound = GetSoundIndex(soundname);
}
int progresssound(string soundname)
{
gProgressSound = GetSoundIndex(soundname);
}
int exploderadius(string str)
{
gExplodeRadius = Str2Real(str);
}
int inradius(string str)
{
gInRadius = Str2Real(str);
}
int timer(string str)
{
gTimer = Str2Real(str);
}
int network(string str)
{
gNetwork = Str2Int(str);
}
int outradius(string str)
{
gOutRadius = Str2Real(str);
}
int damage(string str)
{
hitValue = Str2Int(str);
return 0;
}
int Drop(string dummy)
{
real time ;
time = GetTime(thisObject);
if (state == 0)
{
state = 1;
SetCollidableProperties(thisObject,1,1);
SetStyle(thisObject,2);
PlaySound(thisObject,gStartSound);
wakeupTime = time + 1.0;
}
return 0;
}
int ArmMe(string dummy)
{
Drop(dummy);
}
int Explosion(int param)
{
real time ;
time = GetTime(thisObject);
state = 2;
LaunchEFX(thisObject,2,0);
FireSaveInfo(thisObject,hitValue,0,gMass,1);
Explode(thisObject,hitValue,gExplodeRadius,gMass);
SetStyle(thisObject,4);
PlaySound(thisObject,gEndSound);
SetCollidableProperties(thisObject,0,0);
return 0;
}
int Colliders(string dummy)
{
map::iterator ix;
map objInList;
int value;
objInList = Collisions(thisObject,0,1,0);
for (ix = begin(objInList) ;ix != end(objInList); ++ix)
{
value = AddObjectTo(first(dereference(ix)),thisObject);
if (value != 0)
{
PlaySound(thisObject,35);
state = 0;
SetScale(thisObject,1.0);
break;
}
}
return 0;
}
int TimedEvent(int input)
{
real time;
time = GetTime(thisObject);
if (state == 1)
{
PlaySound(thisObject,gProgressSound);
gTimer = gTimer - 1.0;
if (gTimer <= 0.0)
{
state = 2;
}
SetTimer(thisObject,gTimer);
wakeupTime = time + 1.0;
}
else if (state == 2)
{
Explosion(0);
SendMessage(thisObject,gOutRadius,gNetwork);
Remove(thisObject);
wakeupTime = -1.0;
SetTimer(thisObject,-1.0);
}
else
{
wakeupTime = -1.0;
}
return 0;
}